package com.mystudy.leetcode.problem.tree.p_226;

import com.mystudy.leetcode.base.TreeNode;

/**
 * @program: infoalgorithm
 * @description: 翻转二叉树
 * @author: zhouzhilong
 * @create: 2019-07-23 14:36
 **/
public class Solution {
    public TreeNode invertTree(TreeNode root) {
        if(root == null){
            return  null;
        }
        TreeNode left = root.left;
        TreeNode right = root.right;

        root.left = invertTree(right);
        root.right = invertTree(left);

        return root;

    }
}
